//
//  Macro.h
//  CPetro
//
//  Created by ggx on 2017/3/8.
//  Copyright © 2017年 高广校. All rights reserved.
//  工具宏定义

#ifndef Macro_h
#define Macro_h

#import "HJNavgationViewController.h"

#import "CustomUtil.h"//
#import "UIDevice+YYAdd.h"
#import "UIColor+RRCColor.h"
#import "DYUIViewExt.h"
#import "UIImageView+WebCache.h"

//工程获取info.plist
#define PROJECT_NAME [[[NSBundle mainBundle] infoDictionary] valueForKey:@"CFBundleName"]
#define PROJECT_DISPLAY_NAME [[[NSBundle mainBundle] infoDictionary] valueForKey:@"CFBundleDisplayName"]

//字符串
#define String(XX) [NSString stringWithFormat:@"%@",XX]
#define URLLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);

//工程提交按钮的颜色
#define K_SubmitTitleColor [UIColor darkGrayColor]
#define K_SubmitTitleLayerBorderColor [UIColor darkGrayColor]
#define K_RGBColor(r,g,b) [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:1.0]
//系统配置
#define K_NavigationTitleColor K_RGBColor(255, 255, 255) //导航题颜色
#define K_NavigationBackColor K_RGBColor(59, 152, 254) //导航栏颜色 //偏蓝色

#define K_NaMustBanColor  K_RGBColor(227, 89, 90) //禁用颜色
#define K_SystemFont [UIFont systemFontOfSize:15.0]
#define K_SystemFontFourteen [UIFont systemFontOfSize:14.0]

//适配iphonex
#define IS_IPHONE_X ((SCREEN_HEIGHT == 780.0f || SCREEN_HEIGHT == 812.0f || SCREEN_HEIGHT == 896.0f || SCREEN_HEIGHT == 844.0f || SCREEN_HEIGHT == 926.0f || SCREEN_HEIGHT == 852.0f || SCREEN_HEIGHT == 932.0f) ? YES : NO)
//状态栏高度
#define kHeightNavigationStatusBar    (UIDevice.currentDevice.bearStatusBarHeight) //iPhoneX与iPoneXS_Max一样,齐刘海
//底部安全域高度
#define iPhoneXBottomUnSafeAreaHeight (IS_IPHONE_X==YES? 34 : 0)
//导航栏高度
#define kHeightNavigation             (UIDevice.currentDevice.bearTopBarHeight)
//tabbar高度
#define kHeightTabBar                 (49 + iPhoneXBottomUnSafeAreaHeight)
//导航栏除去状态栏高度
#define KNavHeight                    44
#define kScreenSafeAreaHeight (SCREEN_HEIGHT - iPhoneXBottomUnSafeAreaHeight-kHeightNavigation)


//截取几个屏幕的属性
#define SCREEN_WIDTH [[UIScreen mainScreen]bounds].size.width
#define SCREEN_HEIGHT [[UIScreen mainScreen]bounds].size.height

//yyyy-MM-dd HH:mm
#define K_APP_FORMATTER @"yyyy-MM-dd HH:mm:ss"

//随机字符
#define KRANDSTR [NSString getRandomStringWithNum:2]

//#define Device_Ccale  SCREEN_WIDTH/375
#define Device_Ccale  1
//
inline static CGFloat artIphoneScaleFactor() {
    return SCREEN_WIDTH/375.0;
}


//弱引用
//#define WeakSelf __weak typeof(self) weakSelf = self;
//#define K_Weakself __weak typeof(self) weakSelf = self;

//先做几个常用的xib，快速创建的
#define PushViewController(XX) [self.navigationController pushViewController:XX animated:YES]
#define PushViewControllerName(XX) [self.navigationController pushViewController:CreateViewController(XX) animated:YES]
#define POP [self.navigationController popViewControllerAnimated:YES]
#define PROOTP  [self.navigationController popToRootViewControllerAnimated:YES]
#define CreateViewController(classname) [[NSClassFromString(classname) alloc]initWithNibName:classname bundle:nil]

#endif /* Macro_h */
